//
//  ShipInfo.m
//  SpaceStorm
//
//  Created by 祥 雍 on 13-5-26.
//  Copyright (c) 2013年 __MyCompanyName__. All rights reserved.
//
//  舰船表的信息类

#import "ShipInfo.h"
#import "Variable.h"

@implementation ShipInfo

@synthesize shipId = _shipId;
@synthesize shipBig = _shipBig;
@synthesize shipMid = _shipMid;
@synthesize shipSmall = _shipSmall;

@synthesize level = _level;
@synthesize groupId = _groupId;
@synthesize name = _name;
@synthesize flag = _flag;
@synthesize gold = _gold;
@synthesize buyGold = _buyGold;
@synthesize sellGold = _sellGold;

@synthesize needMilitary = _needMilitary;
@synthesize needtechnology = _needtechnology;
@synthesize needCommander = _needCommander;
@synthesize needJudge = _needJudge;
@synthesize needAttack = _needAttack;
@synthesize needDefense = _needDefense;
@synthesize needEngineDriven = _needEngineDriven;
@synthesize needStrategy = _needStrategy;
@synthesize needSkill = _needSkill;
@synthesize needSkillLevel = _needSkillLevel;
@synthesize fleetCost = _fleetCost;

@synthesize equipValue = _equipValue;
@synthesize shield = _shield;
@synthesize shieldElectricityResistance = _shieldElectricityResistance;
@synthesize shieldBombResistance = _shieldBombResistance;
@synthesize shieldKineticResistance = _shieldKineticResistance;
@synthesize armoured = _armoured;
@synthesize armouredElectricityResistance = _armouredElectricityResistance;
@synthesize armouredBombResistance = _armouredBombResistance;
@synthesize armouredKineticResistance = _armouredKineticResistance;

@synthesize hp = _hp;
@synthesize field = _field;
@synthesize speed = _speed;
@synthesize accelerated = _accelerated;
@synthesize steeringForce = _steeringForce;
@synthesize attackSystem = _attackSystem;
@synthesize defenseSystem = _defenseSystem;
@synthesize servoSystem = _servoSystem;
@synthesize engineRoom = _engineRoom;
@synthesize icon = _icon;
@synthesize modelId = _modelId;
@synthesize addition = _addition;
@synthesize description = _description;
@synthesize BGDescription = _BGDescription;


+(id) infoWithTbxml:(TBXMLElement *)tbxml
{
    return [[[self alloc] initWithTbxml:tbxml] autorelease]; 
}

-(id) initWithTbxml:(TBXMLElement *)tbxml
{
    self = [super init]; 
	
	if (self!= nil) 
    {
        //舰船id	
        self.shipId = [[TBXML valueOfAttributeNamed:@"id" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船id:%d", self.shipId);
        
        //舰船大类	
        self.shipBig = [[TBXML valueOfAttributeNamed:@"shipBig" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船大类:%d", self.shipBig);
        
        //舰船中类
        self.shipMid = [[TBXML valueOfAttributeNamed:@"shipMid" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船中类:%d", self.shipMid);
        
        //舰船细类	
        self.shipSmall = [[TBXML valueOfAttributeNamed:@"shipSmall" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船细类:%d", self.shipSmall);
        
        //科技等级
        self.level = [[TBXML valueOfAttributeNamed:@"level" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"科技等级:%d", self.level);
        
        //小组编号
        self.groupId = [[TBXML valueOfAttributeNamed:@"groupId" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"小组编号:%d", self.groupId);
        
        //舰船名
        self.name = [TBXML valueOfAttributeNamed:@"name" forElement:tbxml];
        if(showXMLLog == YES) CCLOG(@"舰船名:%@", self.name);
        
        //舰船标志
        self.flag = [[TBXML valueOfAttributeNamed:@"flag" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船标志:%d", self.flag);
        
        //金币价	
        self.gold = [[TBXML valueOfAttributeNamed:@"gold" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"金币价:%d", self.gold);
        
        //买入军费	
        self.buyGold = [[TBXML valueOfAttributeNamed:@"buyGold" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"买入军费:%d", self.buyGold);
        
        //卖出军费	
        self.sellGold = [[TBXML valueOfAttributeNamed:@"sellGold" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"卖出军费:%d", self.sellGold);
        
        //舰船需求军衔	
        self.needMilitary = [[TBXML valueOfAttributeNamed:@"needMilitary" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船需求军衔:%d", self.needMilitary);
        
        //舰船需求科技	
        self.needtechnology = [[TBXML valueOfAttributeNamed:@"needtechnology" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船需求科技:%d", self.needtechnology);
        
        //舰船需求统帅	
        self.needCommander = [[TBXML valueOfAttributeNamed:@"needCommander" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船需求统帅:%d", self.needCommander);
        
        //舰船需求判断	
        self.needJudge = [[TBXML valueOfAttributeNamed:@"needJudge" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船需求判断:%d", self.needJudge);
        
        //舰船需求攻击	
        self.needAttack = [[TBXML valueOfAttributeNamed:@"needAttack" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船需求攻击:%d", self.needAttack);
        
        //舰船需求防御	
        self.needDefense = [[TBXML valueOfAttributeNamed:@"needDefense" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船需求防御:%d", self.needDefense);
        
        //舰船需求机动	
        self.needEngineDriven = [[TBXML valueOfAttributeNamed:@"needEngineDriven" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船需求机动:%d", self.needEngineDriven);
        
        //舰船需求谋略	
        self.needStrategy = [[TBXML valueOfAttributeNamed:@"needStrategy" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船需求谋略:%d", self.needStrategy);
        
        //舰船需求技能	
        self.needSkill = [[TBXML valueOfAttributeNamed:@"needSkill" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船需求技能略:%d", self.needSkill);
        
        //舰船需求技能等级	
        self.needSkillLevel = [[TBXML valueOfAttributeNamed:@"needSkillLevel" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船需求技能等级:%d", self.needSkillLevel);
        
        //舰队点数消耗值
        self.fleetCost = [[TBXML valueOfAttributeNamed:@"fleetcost" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船需求技能等级:%d", self.fleetCost);
        
        //舰船装配值	
        self.equipValue = [[TBXML valueOfAttributeNamed:@"equipValue" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船装配值:%d", self.equipValue);
        
        //舰船护盾	
        self.shield = [[TBXML valueOfAttributeNamed:@"shield" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船护盾:%d", self.shield);
        
        //护盾电抗	
        self.shieldElectricityResistance = [[TBXML valueOfAttributeNamed:@"shieldElectricityResistance" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"护盾电抗:%d", self.shieldElectricityResistance);
        
        //护盾爆抗
        self.shieldBombResistance = [[TBXML valueOfAttributeNamed:@"shieldBombResistance" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"护盾爆抗:%d", self.shieldBombResistance);
        
        //护盾动抗	
        self.shieldKineticResistance = [[TBXML valueOfAttributeNamed:@"shieldKineticResistance" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"护盾动抗:%d", self.shieldKineticResistance);
        
        //舰船装甲	
        self.armoured = [[TBXML valueOfAttributeNamed:@"armoured" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船装甲:%d", self.armoured);
        
        //装甲电抗
        self.armouredElectricityResistance = [[TBXML valueOfAttributeNamed:@"armouredElectricityResistance" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"装甲电抗:%d", self.armouredElectricityResistance);
        
        //装甲爆抗	
        self.armouredBombResistance = [[TBXML valueOfAttributeNamed:@"armouredBombResistance" forElement:tbxml] intValue];
        if(showXMLLog == YES)CCLOG(@"装甲爆抗:%d", self.armouredBombResistance);
        
        //装甲动抗	
        self.armouredKineticResistance = [[TBXML valueOfAttributeNamed:@"armouredKineticResistance" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"装甲动抗:%d", self.armouredKineticResistance);
        
        //舰船结构	
        self.hp = [[TBXML valueOfAttributeNamed:@"hp" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船结构:%d", self.hp);
        
        //舰船视野	
        self.field = [[TBXML valueOfAttributeNamed:@"field" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船视野:%d", self.field);
        
        //舰船速度
        self.speed = [[TBXML valueOfAttributeNamed:@"speed" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船速度:%d", self.speed);
        
        //加速力	
        self.accelerated = [[TBXML valueOfAttributeNamed:@"accelerated" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"加速力:%d", self.accelerated);
        
        //转向力	
        self.steeringForce = [[TBXML valueOfAttributeNamed:@"steeringForce" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"转向力:%d", self.steeringForce);
        
        //攻击系统	
        self.attackSystem = [[TBXML valueOfAttributeNamed:@"attackSystem" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"攻击系统:%d", self.attackSystem);
        
        //防御系统	
        self.defenseSystem = [[TBXML valueOfAttributeNamed:@"defenseSystem" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"防御系统:%d", self.defenseSystem);
        
        //辅助系统	
        self.servoSystem = [[TBXML valueOfAttributeNamed:@"servoSystem" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"辅助系统:%d", self.servoSystem);
        
        //舰载机仓	
        self.engineRoom = [[TBXML valueOfAttributeNamed:@"engineRoom" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰载机仓:%d", self.engineRoom);
        
        //图标	
        self.icon = [TBXML valueOfAttributeNamed:@"icon" forElement:tbxml];
        if(showXMLLog == YES) CCLOG(@"图标:%@", self.icon);
                            
        //模型
        self.modelId = [[TBXML valueOfAttributeNamed:@"modelId" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"模型:%d", self.modelId);
        
        //舰船加成
        self.addition = [[TBXML valueOfAttributeNamed:@"addition" forElement:tbxml] intValue];
        if(showXMLLog == YES) CCLOG(@"舰船加成:%d", self.addition);
        
        //说明	
        self.description = [TBXML valueOfAttributeNamed:@"description" forElement:tbxml];
        if(showXMLLog == YES) CCLOG(@"说明:%@", self.description);
        
        //舰船背景	
        self.BGDescription = [TBXML valueOfAttributeNamed:@"BGDescription" forElement:tbxml];
        if(showXMLLog == YES) CCLOG(@"舰船背景:%@", self.BGDescription);
    }
    
    return self;
}

@end
